//package test;
//
//import base.Category;
//import com.sun.lwuit.Container;
//import com.sun.lwuit.Label;
//import db.CategoryManager;
//import java.util.Vector;
//import javax.microedition.midlet.MIDlet;
//
///**
// *
// * @author Shayan
// */
//public class CategoryTestForm extends TestForm {
//
//    public CategoryTestForm(final MIDlet parent) {
//        super(parent);
//        setTitle("Category tests");
//    }
//
//    protected TestForm getNextForm(MIDlet parent) {
//        return new UserTestForm(parent);
//    }
//
//    protected void runTests(Container mainContainer) throws Exception {
//            // Test: getData() & create()
//            Category category = new Category("e25f3cc2-9b26-4ef0-8dab-e88b2ad3695f", "name of category");
//            byte[] data = category.getData();
//            Category another = Category.create(data);
//            mainContainer.addComponent(new Label("getData() & create() for Id:" + another.getId().equalsIgnoreCase("e25f3cc2-9b26-4ef0-8dab-e88b2ad3695f")));
//            mainContainer.addComponent(new Label("getData() & create() for name:" + another.getName().equalsIgnoreCase("name of category")));
//
//            // Test persist & getById
//            Category fromRms = CategoryManager.getById("d935b0ab-9b78-4060-a4b2-d09918ad2356");
//            if (fromRms == null) {
//                mainContainer.addComponent(new Label("getById: not found."));
//            } else {
//                mainContainer.addComponent(new Label("getById: " + fromRms.getName()));
//            }
//            CategoryManager.persist(new Category("d935b0ab-9b78-4060-a4b2-d09918ad2356", "deep blue sky"));
//            mainContainer.addComponent(new Label("persisted:'deep blue sky'"));
//
//            // Several categories
//            CategoryManager.persist(new Category("54265973-ae18-4933-a2bd-67a890f2799e", "shallow red sky"));
//            CategoryManager.persist(new Category("54265973-ae18-4933-a2bd-67a890f2799e", "shallow red sky 2"));
//            CategoryManager.persist(new Category("717580dc-eed0-4429-bbb9-3da71fad9835", "comrade"));
//            CategoryManager.persist(new Category("1b9fd196-d492-45d0-91b7-bdd3317f6858", "common sense"));
//
//            Vector all = CategoryManager.getAll();
//            mainContainer.addComponent(new Label("All categories (" + all.size() + ")"));
//            for (int i = 0; i < all.size(); i++) {
//                Category c = (Category) all.elementAt(i);
//                mainContainer.addComponent(new Label(c.getName()));
//            }
//
//            Category anotherFromRms = CategoryManager.getById("717580dc-eed0-4429-bbb9-3da71fad9835");
//            if (anotherFromRms == null) {
//                mainContainer.addComponent(new Label("another getById: not found."));
//            } else {
//                mainContainer.addComponent(new Label("another getById: " + anotherFromRms.getName()));
//            }
//
//
//    }
//}
